home *** CD-ROM | disk | FTP | other *** search
/ Enter 2001 April / EnterCD4.iso / Update / SQL Server SP3 / sql70sp3i.exe / X86 / BINN / res / 1033 / sqlmmc.rll / HTML / VBREPCOM.BAS < prev    next >
Encoding:
BASIC Source File  |  1999-04-12  |  16.4 KB  |  357 lines

  1. dim strSearch
  2. dim strSeparator
  3.  
  4. on error resume next
  5. strSearch = ""
  6.  
  7. ' *************************************************
  8. ' GetParameter( strParam )
  9. '
  10. ' Parses the command line for the request parameter
  11. ' *************************************************
  12.  
  13. function GetParameter(ByVal strParam) 
  14.   dim intStart
  15.   dim intLast
  16.   dim strFind
  17.  
  18.   if (strSearch = "") then
  19.     strSearch = document.location.search
  20.  
  21.     ' If search is empty then we are using a FILE protocol instead of HTTP,
  22.     ' so get the entire command line.  Also, the parameter delimiter is different.
  23.     if (len(strSearch) = 0) then
  24.       strSearch = document.location.href
  25.       'strSeparator = "%3F"
  26.       strSeparator = "#"
  27.     else
  28.       strSeparator = "?"
  29.     end if
  30.   end if
  31.  
  32.   strFind = strSeparator & strParam
  33.  
  34.   intStart = instr( 1, strSearch, strFind, 0 )
  35.   if (intStart = 0) then
  36.     GetParameter = ""
  37.   else
  38.     intStart = intStart + len(strFind) + 1
  39.     intLast = instr( intStart, strSearch, strSeparator, 0 )
  40.     if (intLast = 0) then intLast = len(strSearch) + 1
  41.     GetParameter = mid(strSearch, intStart, intLast-intStart)
  42.   end if
  43.  
  44. end function
  45.  
  46.  
  47. function GetResString(ByVal iString)
  48.     GetResString = "????"    ' default
  49.     On Error Resume Next
  50.     Select Case iString
  51.         Case 1  GetResString = objSQLNSContext.ProvideLocalizedString("", 5001)        '"Find Lineage"
  52.         Case 2  GetResString = objSQLNSContext.ProvideLocalizedString("", 5002)        '"Lineage Long:"
  53.         Case 3  GetResString = objSQLNSContext.ProvideLocalizedString("", 5003)        '"Lineage Short:"
  54.         Case 4  GetResString = objSQLNSContext.ProvideLocalizedString("", 5004)        '"Source Packages"
  55.         Case 5  GetResString = objSQLNSContext.ProvideLocalizedString("", 5005)        '"Target Packages"  -> "Destination Packages"
  56.         Case 6  GetResString = objSQLNSContext.ProvideLocalizedString("", 5006)        '"Version"
  57.         Case 7  GetResString = objSQLNSContext.ProvideLocalizedString("", 5007)        '"Lineage"
  58.         Case 8  GetResString = objSQLNSContext.ProvideLocalizedString("", 5008)        '"System"
  59.         Case 9  GetResString = objSQLNSContext.ProvideLocalizedString("", 5009)        '"Account"
  60.         Case 10 GetResString = objSQLNSContext.ProvideLocalizedString("", 5010)        '"Exection Time"
  61.         Case 11 GetResString = objSQLNSContext.ProvideLocalizedString("", 5011)        '"Database"
  62.         Case 12 GetResString = objSQLNSContext.ProvideLocalizedString("", 5012)        '"Schema"
  63.         Case 13 GetResString = objSQLNSContext.ProvideLocalizedString("", 5013)        '"Table"
  64.         Case 14 GetResString = objSQLNSContext.ProvideLocalizedString("", 5014)        '"Column"
  65.         Case 15 GetResString = objSQLNSContext.ProvideLocalizedString("", 5015)        '"Description"
  66.         Case 16 GetResString = objSQLNSContext.ProvideLocalizedString("", 5016)        '"Sources"
  67.         Case 17 GetResString = objSQLNSContext.ProvideLocalizedString("", 5017)        '"Table"
  68.         Case 18 GetResString = objSQLNSContext.ProvideLocalizedString("", 5018)        '"Column"
  69.         Case 19 GetResString = objSQLNSContext.ProvideLocalizedString("", 5020)        '"Destinations"
  70.         Case 20 GetResString = objSQLNSContext.ProvideLocalizedString("", 5022)        '"Loading database information..."        ' can't do this one because it is displayed right away
  71.         Case 21 GetResString = objSQLNSContext.ProvideLocalizedString("", 5023)        '"An error occurred while trying to access the database information."
  72.         Case 22 GetResString = objSQLNSContext.ProvideLocalizedString("", 5024)        '"Browse"
  73.         Case 23 GetResString = objSQLNSContext.ProvideLocalizedString("", 5025)        '"Lineage"
  74.         Case 24 GetResString = objSQLNSContext.ProvideLocalizedString("", 5026)        '"Please specify a Lineage Long or a Lineage Short."
  75.         Case 25 GetResString = objSQLNSContext.ProvideLocalizedString("", 5027)        '"The database is not accessible."
  76.         Case 26 GetResString = objSQLNSContext.ProvideLocalizedString("", 5028)        '"The msdb database is not accessible."
  77.         Case 27 GetResString = objSQLNSContext.ProvideLocalizedString("", 5029)        '"The database could not be opened."
  78.         Case 28 GetResString = objSQLNSContext.ProvideLocalizedString("", 5030)        '"The msdb database could not be opened."
  79.         Case 29 GetResString = objSQLNSContext.ProvideLocalizedString("", 5031)        '"Repository"
  80.         Case 30 GetResString = objSQLNSContext.ProvideLocalizedString("", 5032)        '"Repository Browse"  -> Repository metadata
  81.         Case 31 GetResString = objSQLNSContext.ProvideLocalizedString("", 5068)        '"Repository Lineage Lookup"  -> Repository lineage lookup
  82.         Case 32 GetResString = objSQLNSContext.ProvideLocalizedString("", 5019)        '"Packages"
  83.         Case 33 GetResString = objSQLNSContext.ProvideLocalizedString("", 5062)        '"Source/Destination"
  84.         Case 34 GetResString = objSQLNSContext.ProvideLocalizedString("", 5063)        '"DataType"
  85.         Case 35 GetResString = objSQLNSContext.ProvideLocalizedString("", 5064)        '"Length"
  86.         Case 36 GetResString = objSQLNSContext.ProvideLocalizedString("", 5065)        '"Scale"
  87.         Case 37 GetResString = objSQLNSContext.ProvideLocalizedString("", 5066)        '"Precision"
  88.         Case 38 GetResString = objSQLNSContext.ProvideLocalizedString("", 5067)        '"Nulls"
  89.         Case 39 GetResString = objSQLNSContext.ProvideLocalizedString("", 5061)        '"Lineage Not Found."
  90.         Case 40 GetResString = objSQLNSContext.ProvideLocalizedString("", 5069)        '"Lineage Long"
  91.         Case 41 GetResString = objSQLNSContext.ProvideLocalizedString("", 5070)        '"Lineage Short"
  92.         Case 42 GetResString = objSQLNSContext.ProvideLocalizedString("", 5033)        '"Lineages"
  93.         Case 43 GetResString = objSQLNSContext.ProvideLocalizedString("", 5034)        '"Design"
  94.         Case 44 GetResString = objSQLNSContext.ProvideLocalizedString("", 5035)        '"Name:"
  95.         Case 45 GetResString = objSQLNSContext.ProvideLocalizedString("", 5036)        '"Version:"
  96.         Case 46 GetResString = objSQLNSContext.ProvideLocalizedString("", 5037)        '"Description:"
  97.         Case 47 GetResString = objSQLNSContext.ProvideLocalizedString("", 5038)        '"Comments:"
  98.         Case 48 GetResString = objSQLNSContext.ProvideLocalizedString("", 5039)        '"Author:"
  99.         Case 49 GetResString = objSQLNSContext.ProvideLocalizedString("", 5040)        '"Author Information:"
  100.         Case 50 GetResString = objSQLNSContext.ProvideLocalizedString("", 5041)        '"Create By User:"
  101.         Case 51 GetResString = objSQLNSContext.ProvideLocalizedString("", 5042)        '"Modified By User:"
  102.         Case 52 GetResString = objSQLNSContext.ProvideLocalizedString("", 5043)        '"Version Create Time:"
  103.         Case 53 GetResString = objSQLNSContext.ProvideLocalizedString("", 5044)        '"Version Modified Time:"
  104.         Case 54 GetResString = objSQLNSContext.ProvideLocalizedString("", 5045)        '"Package Creation Date:"
  105.         Case 55 GetResString = objSQLNSContext.ProvideLocalizedString("", 5046)        '"PackageID:"
  106.         Case 56 GetResString = objSQLNSContext.ProvideLocalizedString("", 5047)        '"Exception Log:"
  107.         Case 57 GetResString = objSQLNSContext.ProvideLocalizedString("", 5048)        '"System:"
  108.         Case 58 GetResString = objSQLNSContext.ProvideLocalizedString("", 5049)        '"Account:"
  109.         Case 59 GetResString = objSQLNSContext.ProvideLocalizedString("", 5050)        '"Execution Time:"
  110.         Case 60 GetResString = objSQLNSContext.ProvideLocalizedString("", 5051)        '"Data Type:"
  111.         Case 61 GetResString = objSQLNSContext.ProvideLocalizedString("", 5052)        '"Length:"
  112.         Case 62 GetResString = objSQLNSContext.ProvideLocalizedString("", 5053)        '"Scale:"
  113.         Case 63 GetResString = objSQLNSContext.ProvideLocalizedString("", 5054)        '"Precision:"
  114.         Case 64 GetResString = objSQLNSContext.ProvideLocalizedString("", 5055)        '"Nulls:"
  115.         Case 65 GetResString = objSQLNSContext.ProvideLocalizedString("", 5071)        '"Update"
  116.         Case 66 GetResString = objSQLNSContext.ProvideLocalizedString("", 5072)        '"Schema Name:"
  117.         Case 67 GetResString = objSQLNSContext.ProvideLocalizedString("", 5073)        '"Database Name:"
  118.         Case 68 GetResString = objSQLNSContext.ProvideLocalizedString("", 5074)        '"Table Name:"
  119.         Case 69 GetResString = objSQLNSContext.ProvideLocalizedString("", 5075)        '"Column Name:"
  120.         Case 70 GetResString = objSQLNSContext.ProvideLocalizedString("", 5076)        '"More than 20 items found...."
  121.         Case 71 GetResString = objSQLNSContext.ProvideLocalizedString("", 5077)        '"Microsoft SQL Server metadata Information"
  122.         Case 72 GetResString = objSQLNSContext.ProvideLocalizedString("", 5078)        '"Lineage allows you to ..."
  123.         Case 73 GetResString = objSQLNSContext.ProvideLocalizedString("", 5079)        '"This browse allows you to view the metadata ..."
  124.         Case 74 GetResString = objSQLNSContext.ProvideLocalizedString("", 5080)        '"You can also "
  125.         Case 75 GetResString = objSQLNSContext.ProvideLocalizedString("", 5081)        '"import metadata."
  126.         Case 76 GetResString = objSQLNSContext.ProvideLocalizedString("", 5082)        '"There is no metadata ..."
  127.         Case 77 GetResString = objSQLNSContext.ProvideLocalizedString("", 5083)        '"Return to "
  128.         Case 78 GetResString = objSQLNSContext.ProvideLocalizedString("", 5084)        '"Package"
  129.         Case 79 GetResString = objSQLNSContext.ProvideLocalizedString("", 5085)        '"DTS packages define one or more ..."
  130.         Case 80 GetResString = objSQLNSContext.ProvideLocalizedString("", 5086)        '"Package browse"
  131.         Case 81 GetResString = objSQLNSContext.ProvideLocalizedString("", 5087)        '"versioned on "
  132.         Case 82 GetResString = objSQLNSContext.ProvideLocalizedString("", 5088)        '"Microsoft SQL Server Repository Information"
  133.         Case 83 GetResString = objSQLNSContext.ProvideLocalizedString("", 5089)        '"executed on "
  134.         Case 84 GetResString = objSQLNSContext.ProvideLocalizedString("", 5090)        '"Working..."
  135.         Case 85 GetResString = objSQLNSContext.ProvideLocalizedString("", 5091)        '"There are no DTS Packages..."
  136.         Case 86 GetResString = objSQLNSContext.ProvideLocalizedString("", 5092)        '"After importing..."
  137.     End Select
  138.     On Error GoTo 0
  139. end function
  140.  
  141.  
  142. Sub SetupStaticStrings()
  143.     Dim strHTML
  144.  
  145.     LineageInLink.innerText = GetResString(1)
  146.     LineageInLong.innerText = GetResString(2)
  147.     LineageInShort.innerText = GetResString(3)
  148.     LineageAnotText.innerText = GetResString(72)
  149.     PackagePropSrcPackTxt.innerText = GetResString(4)
  150.     PackagePropTgtPackTxt.innerText = GetResString(5)
  151.     VerLinListVerTxt.innerText = GetResString(6)
  152.     VerLinListLinTxt.innerText = GetResString(7)
  153.     VerLinListSysTxt.innerText = GetResString(8)
  154.     VerLinListAccountTxt.innerText = GetResString(9)
  155.     VerLinListExectimeTxt.innerText = GetResString(10)
  156.     BrowseDbTxt.innerText = GetResString(11)
  157.     BrowseSchemaTxt.innerText = GetResString(12)
  158.     BrowseTableTxt.innerText = GetResString(13)
  159.     BrowseColumnTxt.innerText = GetResString(14)
  160.     BrowseDescTxt.innerText = GetResString(15)
  161.     PackBrowsePackTxt.innerText = GetResString(78)
  162.     PackBrowseVerTxt.innerText = GetResString(6)
  163.     PackBrowseLinTxt.innerText = GetResString(7)
  164.     PackBrowseSysTxt.innerText = GetResString(8)
  165.     PackBrowseAccountTxt.innerText = GetResString(9)
  166.     PackBrowseExectimeTxt.innerText = GetResString(10)
  167.     PackBrowseDesc.innerText = GetResString(15)
  168.     SrcTgtMapsSourcesTxt.innerText = GetResString(16)
  169.     SrcTgtMapsTableTxt.innerText = GetResString(17)
  170.     SrcTgtMapsColumnTxt.innerText = GetResString(18)
  171.     SrcTgtMapsDescTxt.innerText = GetResString(15)
  172.     SrcTgtMapsDestTxt.innerText = GetResString(19)
  173.     SrcTgtMapsTable2Txt.innerText = GetResString(17)
  174.     SrcTgtMapsColumn2Txt.innerText = GetResString(18)
  175.     SrcTgtMapsDesc2Txt.innerText = GetResString(15)
  176.     'MessageTxt.innerText = GetResString(20)        ' can't do this one because it is displayed right away
  177.     strHTML = "<br>"
  178.     strHTML = strHTML & GetResString(21)
  179.     strHTML = strHTML & "<br>"
  180.     strHTML = strHTML & "<span id=""errortext""></span>"
  181.     errorspan.innerHTML = strHTML
  182.     strHTML = GetResString(73)
  183.     strHTML = strHTML & "<br>"
  184.     strHTML = strHTML & GetResString(74)
  185.     strHTML = strHTML & "<a class=""TableRowButton"" href language=""jscript"" onclick=""ImportMetadataCall()"">" & GetResString(75) & "</a>"
  186.     BrowseAnotText.innerHTML = strHTML
  187. End Sub
  188.  
  189. Dim arrHistoryFunc()
  190. Dim arrHistoryText()
  191. Dim arrHistoryParam1()
  192. Dim arrHistoryParam2()
  193. Dim iHistorySize
  194. Dim timer2
  195. Dim bInTimer
  196. Function AddToHistory(funcNumber, strText, vParam1, vParam2)
  197.     ' 1 browse
  198.     ' 2 lineage
  199.     ' 3 LinPackageProp
  200.     ' 4 PackagesProp
  201.     ' 5 SrcTgtPackageProp
  202.     ' 6 VerLinList
  203.     ' 7 SrcTgtMaps
  204.     ' 8 TableProp
  205.     ' 9 ColumnProp
  206.     ' 10 Package browse
  207.     ' 20 BrwOpen
  208.     ' 21 BrwClose
  209.     if (bInTimer) then
  210.         AddToHistory = True
  211.         bInTimer = False
  212.         Exit Function
  213.     end if
  214.     AddToHistory = False
  215.  
  216.     if (iHistorySize > 0) then
  217.         'if (funcNumber = arrHistoryFunc(iHistorySize - 1)) then
  218.         '    Exit Function
  219.         'end if
  220.         if ( (funcNumber = 1) or (funcNumber = 2) or (funcNumber = 10) ) and ( (arrHistoryFunc(iHistorySize - 1) = 1) or (arrHistoryFunc(iHistorySize - 1) = 2) or (arrHistoryFunc(iHistorySize - 1) = 10) ) then
  221.             iHistorySize = iHistorySize - 1        ' overwrite, don't add to stack
  222.         end if
  223.     end if
  224.     'iMax = UBound(arrHistoryText)
  225.     ReDim Preserve arrHistoryFunc(iHistorySize)
  226.     ReDim Preserve arrHistoryText(iHistorySize)
  227.     ReDim Preserve arrHistoryParam1(iHistorySize)
  228.     ReDim Preserve arrHistoryParam2(iHistorySize)
  229.     arrHistoryFunc(iHistorySize) = funcNumber
  230.     arrHistoryText(iHistorySize) = strText
  231.     arrHistoryParam1(iHistorySize) = vParam1
  232.     arrHistoryParam2(iHistorySize) = vParam2
  233.     iHistorySize = iHistorySize + 1
  234.  
  235.     txtWait.innerText = GetResString(84)    '"Working..."
  236.     ' set the timer so we actually call the function
  237.     timer2 = window.setInterval("FinishTimer();",1,"JScript")
  238.     bInTimer = True
  239. End Function
  240.  
  241. Sub FinishTimer()
  242.     Call window.clearInterval(timer2)
  243.     if iHistorySize >= 1 then
  244.         if (arrHistoryFunc(iHistorySize - 1) >= 20) then
  245.             Call CallHistory(True)    ' we don't want simple browsing to end up in the history
  246.         else
  247.             Call CallHistory(False)
  248.         end if
  249.     end if
  250.     txtWait.innerText = ""
  251. End Sub
  252.  
  253. Sub CallHistory(bRemove)
  254.     Dim funcNumber
  255.     Dim strText
  256.     Dim vParam1
  257.     Dim vParam2
  258.     Dim vParam3
  259.  
  260.     if (iHistorySize <= 0) then
  261.         Exit Sub    ' there is no history
  262.     end if
  263.     funcNumber = arrHistoryFunc(iHistorySize - 1)
  264.     strText = arrHistoryText(iHistorySize - 1)
  265.     vParam1 = arrHistoryParam1(iHistorySize - 1)
  266.     vParam2 = arrHistoryParam2(iHistorySize - 1)
  267.     if (bRemove) then
  268.         ReDim Preserve arrHistoryFunc(iHistorySize - 1)
  269.         ReDim Preserve arrHistoryText(iHistorySize - 1)
  270.         ReDim Preserve arrHistoryParam1(iHistorySize - 1)
  271.         ReDim Preserve arrHistoryParam2(iHistorySize - 1)
  272.         iHistorySize = iHistorySize - 1
  273.     end if
  274.     Select Case funcNumber
  275.         Case 1  Call OpenView(document.all.mnu_0)
  276.         Case 2  Call OpenView(document.all.mnu_1)
  277.         Case 3  Call ShowLinsPackagesProp(strText, vParam1)
  278.         Case 4  Call ShowPackagesProp(strText, vParam1)
  279.         Case 5  Call ShowSrcTgtPackageProp(strText, vParam1, vParam2)
  280.         Case 6  Call OnLineages(strText, vParam1)
  281.         Case 7  Call ShowSrcTgtMaps(strText, vParam1, vParam2)
  282.         Case 8  Call ShowTableProp(strText, vParam1)
  283.         Case 9  Call ShowColumnProp(strText, vParam1)
  284.         Case 10 Call OpenView(document.all.mnu_2)
  285.         Case 20 Call BrwOpen(vParam1)
  286.         Case 21 Call BrwClose(vParam1)
  287.     End Select
  288. End Sub
  289.  
  290. Sub PopHistory()
  291.     if (iHistorySize <= 1) then
  292.         Exit Sub    ' when there is only one element on the stack then it is itself
  293.     end if
  294.     iHistorySize = iHistorySize - 1
  295.     Call CallHistory(True)
  296. End Sub
  297.  
  298. Function GetLastHistoryText()
  299.     'iMax = UBound(arrHistoryText)
  300.     if (iHistorySize <= 1) then
  301.         GetLastHistoryText = ""        ' when there is only one element on the stack then it is itself
  302.     else
  303.         GetLastHistoryText = arrHistoryText(iHistorySize - 2)
  304.     end if
  305. End Function
  306.  
  307.  
  308.  
  309.  
  310. Sub ImportMetadataCall
  311.     call objSQLNSContext.InvokeCommand(strContextCookie, 3142)
  312.     location.reload(TRUE)
  313. End Sub
  314.  
  315. Sub DesignCall(strPackageID, strVersion, strName, strRepositoryVersionGuid)
  316.     varPackage = 0
  317.     
  318.     varCurrentNode = objSQLNSContext.GetContextItem(strContextCookie)
  319.     varDTSNode = objSQLNSContext.GetParentItem(varCurrentNode)
  320.     varReposPkgs = objSQLNSContext.GetChildItemByInternalName(varDTSNode, "Repository Packages")
  321.     varPackage = objSQLNSContext.GetChildItemByInternalName(varReposPkgs, strName)
  322.  
  323.     if varPackage > 0 then
  324.         call objSQLNSContext.InvokeCommandOnItemWithParam(strContextCookie, varPackage, 3128, strVersion)
  325.     end if
  326. End Sub
  327.  
  328.  
  329. Function MyHTMLEncode(ByVal strString)
  330.     Dim idx
  331.     Dim strNewString
  332.     Dim strChar
  333.  
  334.     If IsEmpty(strString) then
  335.         MyHTMLEncode = " "
  336.         Exit Function
  337.     End if
  338.     If IsNull(strString) then
  339.         MyHTMLEncode = " "
  340.         Exit Function
  341.     End if
  342.     For idx=1 to Len(strString)
  343.         strChar = Mid(strString, idx, 1)
  344.         If strChar = "<" then
  345.             strNewString = strNewString & "<"
  346.         elseif strChar = ">" then
  347.             strNewString = strNewString & ">"
  348.         elseif strChar = "&" then
  349.             strNewString = strNewString & "&"
  350.         elseif strChar = """" then
  351.             strNewString = strNewString & """
  352.         else
  353.             strNewString = strNewString & strChar
  354.         end if
  355.     Next
  356.     MyHTMLEncode = strNewString
  357. End Function